package com.test.study.ToolsUtils.netty;

import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.ChannelInitializer;
import io.netty.channel.ChannelOption;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioServerSocketChannel;

/**
 * 本类用于对Netty的学习
 * 
 * @author huyong
 *
 */
public class Server {
	public static void main(String[] args) {
		EventLoopGroup pGroup=new NioEventLoopGroup();//用于处理服务器端接受客户端连接
		EventLoopGroup cGroup=new NioEventLoopGroup();//用于进行网络通信的（网络读写的）
		ServerBootstrap b=new ServerBootstrap();//创建辅助工具类，用于服务器通信的一些配置
		b.group(pGroup,cGroup).channel(NioServerSocketChannel.class).option(ChannelOption.SO_BACKLOG, 1024).option(ChannelOption.SO_SNDBUF, 32*1024).option(ChannelOption.SO_RCVBUF,32*1024).option(ChannelOption.SO_KEEPALIVE, true).childHandler(new ChannelInitializer<SocketChannel>() {

			@Override
			protected void initChannel(SocketChannel ch) throws Exception {
				ch.pipeline().addLast();
			}
		});
		
	}

}
